package com.naiterui.ehp.bs.emr.controller.doctor;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.bo.emr.MedicalRecordSettingBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.emr.service.IMedicalRecordSettingService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
 * 病历设置
 * 
 * @author yangfuya
 * @since 2022/4/11
 */
@Api(tags = SwaggerTag.DOCTOR + SwaggerTag.MEDICAL_RECORD)
@RequiredArgsConstructor
@RestController
@RequestMapping("emr/setting")
public class EmrMedicalRecordSettingContoller {
    private final IMedicalRecordSettingService medicalRecordSettingService;

    @ApiOperation("病历设置列表")
    @ApiImplicitParam(name = "doctorId", value = "医生ID", required = true, dataType = "long", paramType = "query")
    @GetMapping("list")
    public List<MedicalRecordSettingBO> listByDoctorId(@RequestParam Long doctorId) {
        return this.medicalRecordSettingService.listByDoctorId(doctorId);
    }

    @ApiOperation("病历设置编辑")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "doctorId", value = "医生ID", required = true, dataType = "long", paramType = "query"),
        @ApiImplicitParam(name = "doctorId", value = "开启的类型字符串（以,分割）只穿开启的类型", required = true, dataType = "string",
            paramType = "query")})
    @PostMapping("edit")
    public void listByDoctorId(@RequestParam Long doctorId, @RequestParam String typeStr) throws BusinessException {
        this.medicalRecordSettingService.edit(doctorId, typeStr);
    }
}
